<template>
  <div>
    <ACard class="erp-m-10">
      <div class="total-assets">
        <div class="item-moddle">
          <div class="moddle-title">总资产</div>
          <div class="moddle-num">{{ formatPrice(totalAssetsData.totalAssetAmt, 1) }}</div>
        </div>
        <div class="item-moddle">
          <div class="moddle-title">账户余额</div>
          <div class="moddle-num">{{ formatPrice(totalAssetsData.accountBalance, 1) }}</div>
        </div>
        <div class="item-moddle">
          <div class="moddle-title">应收账款</div>
          <div class="moddle-num">{{ formatPrice(totalAssetsData.pendingInBillAmt, 1) }}</div>
        </div>
        <div class="item-moddle">
          <div class="moddle-title">应付账款</div>
          <div class="moddle-num">{{ formatPrice(totalAssetsData.pendingOutBillAmt, 1) }}</div>
        </div>
        <div class="item-moddle">
          <div class="moddle-title">库存金额</div>
          <div class="moddle-num">{{ formatPrice(totalAssetsData.stockAmt, 1) }}</div>
        </div>
        <div class="item-moddle">
          <div class="moddle-title">固定资产</div>
          <div class="moddle-num">{{ formatPrice(totalAssetsData.fixAssetAmt, 1) }}</div>
        </div>
      </div>
    </ACard>
    <BusinessSituation class="erp-m-10"></BusinessSituation>
    <SalesStatus class="erp-m-10"></SalesStatus>
    <MaterialPurchase class="erp-m-10"></MaterialPurchase>
    <IncomeExpenditure class="erp-m-10"></IncomeExpenditure>
  </div>
</template>

<script lang="ts" setup>
import { formatPrice } from '@renderer/utils/mixins'
import BusinessSituation from './businessSituation.vue'
import IncomeExpenditure from './incomeExpenditure.vue'
import MaterialPurchase from './materialPurchase.vue'
import SalesStatus from './salesStatus.vue'
import { getTotalAssets, TotalAssetsRes } from '@renderer/api/financialStatement'

const totalAssetsData = ref<TotalAssetsRes>({
  totalAssetAmt: 0,
  accountBalance: 0,
  pendingInBillAmt: 0,
  pendingOutBillAmt: 0,
  stockAmt: 0,
  fixAssetAmt: 0
})
function getTotalAssetsData() {
  getTotalAssets().then((res) => {
    totalAssetsData.value = res.data
  })
}
onMounted(() => {
  getTotalAssetsData()
})
</script>
<style scoped lang="less">
.total-assets {
  display: flex;
  justify-content: space-between;
  .item-moddle {
    .moddle-title {
      font-size: 16px;
    }
    .moddle-num {
      font-size: 20px;
      font-weight: bold;
      margin-top: 4px;
    }
  }
}
</style>
